\documentclass[12pt, a4paper]{article}
\usepackage{layouts}
% \usepackage[showframe]{geometry}
\usepackage{xunicode}
\usepackage{fontspec}
\usepackage{xltxtra} %
\usepackage{url} 
\usepackage{listings}
\usepackage{appendix}

% \appendixtitleon
% \appendixheaderon
\usepackage[onehalfspacing]{setspace}
\usepackage[nottoc]{tocbibind}


% Valodu atbalsts
\usepackage{polyglossia}
\setdefaultlanguage{latvian}
\setotherlanguages{english,russian}
\usepackage{bacdarbs}



\newcommand{\Keywords}[1]{\par\noindent{\small{\em Keywords\/}: #1}}
\newcommand{\kw}[2]{\par\noindent{\small{\em #1\/}: #2}}
\defaultfontfeatures{Mapping=tex-text}
% \setlength{\parindent}{0.0in}
% \setlength{\parskip}{0.1in}

% \univer{Latvijas Universitāte}
% \univ{LU}
% \fakul{Datorikas}
% \nod{}
% \komis{r}
% 
% \darbatips{bakalaura}
% \gads{2012}
% 
% 
% \vaditajs{Uldis Straujums}
% \recenzents{}
% \sekretars{}
% \datums{}



\nosaukums{Personalizēta universitātes iekšējā portāla izstrāde}
\darbatips{Bakalaura}
\autors{Viktors Jengovatovs}
\vadvards{Uldis Straujums}
\vadinfo{Dr.dat.}
% \vadinfo{profesors Dr.sc.comp.}
\gads{2012}
\univer{Latvijas Universitāte}
\univ{LU}
\fakul{Datorikas}
\datums{28.05.2012.}

\students{Viktors Jengovatovs}
\recvards{Viesturs Vēzis}
\recamats{profesors Dr.dat.}
\sekretars{}
\apl_num{vj08053}
\metod{vecākā metodiķe Ārija Sproģe}
\komis{bakalaura gala}
\aizstdatums{07.06.2012.}

%\renewcommand*\rmdefault{cmdh}
%\renewcommand*\rmdefault{Liberdtine}
%\usepackage{Libertine}
\usepackage[EU1]{fontenc}
% \setmainfont{DejaVu Serif}  %% задаёт основной шрифт документа
% \setsansfont{DejaVu Sans}  %% задаёт шрифт без засечек
% \setmonofont{DejaVu Sans Mono}  %% задаёт моноширинный шрифт

\setmainfont{Minion Pro}
\newfontfamily{\cyrillicfont}{CMU Concrete}
% \fontspec[
% SmallCapsFont={Minion MM Small Caps & Oldstyle Figures}
% ]{Minion Pro}

% \setmainfont{Theano Didot}
% \setmainfont{URW Chancery L}
% \setmainfont{CMU Serif}

%%%%%%%%%%%%%%%%%% TODO uncomment
%\setmainfont[Mapping=tex-text]{Cambria}
%\def\DNencdefault{EU1}
%\def\DNrmdefault{lmr}
%%%%%%%%%%%%%%5

% Fonti -- var rakstīt sistēmas fontu nosaukumus
%\setmainfont{arial}
%\setsansfont{adforn}



\usepackage{hyperref}
\hypersetup{
    colorlinks,
    citecolor=black,
    filecolor=black,
    linkcolor=black,
    urlcolor=blue
}



\let\stdsection\section{}
\renewcommand\section{\newpage\stdsection}

\let\stddsection\section{}
\renewcommand\section{\setcounter{figure}{0}\setcounter{table}{0}\newpage\stddsection}

\let\stdabstract\abstract{}
\renewcommand\abstract{\newpage\stdabstract}


\def\uppercasesingleletter#1{\uppercase{#1}}
\newcommand*{\formatfirst}[1]{\MakeUppercase{#1}}


\usepackage{amsmath}

\usepackage{anysize}
\marginsize{3cm}{2cm}{2cm}{2cm}

\usepackage{minted}
\renewcommand\listingscaption{pirmkods}
\usepackage{fixlatvian-vj}
\usepackage[labelfont=it,textfont=bf]{caption}
\renewcommand{\thefigure}{\arabic{section}.\arabic{figure}}
\renewcommand{\thetable}{\arabic{section}.\arabic{table}}



\captionsetup[table]{font=small,position=top,labelsep=newline,
justification=raggedleft, singlelinecheck=false}
\captionsetup[figure]{font=small,position=above}



\usepackage[intoc]{nomencl}
\makenomenclature
\setlength{\nomlabelwidth}{.01\hsize}
% \renewcommand{\nomlabel}[1]{\hfil\textbf{#1}\hfill}
\renewcommand{\nomlabel}[1]{\hfil\textbf{#1} --}
% \renewcommand{\nomname}{\centerline{Список сокращений}}



\begin{document}

\titullapa
\setcounter{tocdepth}{4}
\include{abstracts}
\tableofcontents
\include{dictionary}
\include{intro}
\include{situation}
\include{requirements}
\include{standards}
\include{available}
\include{design}
\include{implementation}
\include{results}
\include{conclusion}
\include{gratitudes}
% \listoffigures
\bibliography{bib.bib}{}
\bibliographystyle{rtu}

\include{appendixes}

\reglapa
\end{document}